import 'package:flutter_taotaoshipin/generated/json/base/json_convert_content.dart';
import 'package:flutter_taotaoshipin/model/drama_main_info_entity.dart';

DramaMainInfoEntity $DramaMainInfoEntityFromJson(Map<String, dynamic> json) {
  final DramaMainInfoEntity dramaMainInfoEntity = DramaMainInfoEntity();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    dramaMainInfoEntity.id = id;
  }
  final int? chnId = jsonConvert.convert<int>(json['chn_id']);
  if (chnId != null) {
    dramaMainInfoEntity.chnId = chnId;
  }
  final int? type = jsonConvert.convert<int>(json['type']);
  if (type != null) {
    dramaMainInfoEntity.type = type;
  }
  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    dramaMainInfoEntity.title = title;
  }
  final String? cover = jsonConvert.convert<String>(json['cover']);
  if (cover != null) {
    dramaMainInfoEntity.cover = cover;
  }
  final int? allEp = jsonConvert.convert<int>(json['all_ep']);
  if (allEp != null) {
    dramaMainInfoEntity.allEp = allEp;
  }
  final int? updateEp = jsonConvert.convert<int>(json['update_ep']);
  if (updateEp != null) {
    dramaMainInfoEntity.updateEp = updateEp;
  }
  final int? chargeSort = jsonConvert.convert<int>(json['charge_sort']);
  if (chargeSort != null) {
    dramaMainInfoEntity.chargeSort = chargeSort;
  }
  final int? isEnd = jsonConvert.convert<int>(json['is_end']);
  if (isEnd != null) {
    dramaMainInfoEntity.isEnd = isEnd;
  }
  final String? desc = jsonConvert.convert<String>(json['desc']);
  if (desc != null) {
    dramaMainInfoEntity.desc = desc;
  }
  final int? ctime = jsonConvert.convert<int>(json['ctime']);
  if (ctime != null) {
    dramaMainInfoEntity.ctime = ctime;
  }
  final String? thumbCover = jsonConvert.convert<String>(json['thumb_cover']);
  if (thumbCover != null) {
    dramaMainInfoEntity.thumbCover = thumbCover;
  }
  final int? isSelf = jsonConvert.convert<int>(json['is_self']);
  if (isSelf != null) {
    dramaMainInfoEntity.isSelf = isSelf;
  }
  final int? videoLibraryId = jsonConvert.convert<int>(
      json['video_library_id']);
  if (videoLibraryId != null) {
    dramaMainInfoEntity.videoLibraryId = videoLibraryId;
  }
  final String? videoLibraryName = jsonConvert.convert<String>(
      json['video_library_name']);
  if (videoLibraryName != null) {
    dramaMainInfoEntity.videoLibraryName = videoLibraryName;
  }
  final String? videoLibraryCode = jsonConvert.convert<String>(
      json['video_library_code']);
  if (videoLibraryCode != null) {
    dramaMainInfoEntity.videoLibraryCode = videoLibraryCode;
  }
  final int? canCurPay = jsonConvert.convert<int>(json['can_cur_pay']);
  if (canCurPay != null) {
    dramaMainInfoEntity.canCurPay = canCurPay;
  }
  final int? canVipWatch = jsonConvert.convert<int>(json['can_vip_watch']);
  if (canVipWatch != null) {
    dramaMainInfoEntity.canVipWatch = canVipWatch;
  }
  final int? canAdPay = jsonConvert.convert<int>(json['can_ad_pay']);
  if (canAdPay != null) {
    dramaMainInfoEntity.canAdPay = canAdPay;
  }
  final int? canBuyoutDrama = jsonConvert.convert<int>(
      json['can_buyout_drama']);
  if (canBuyoutDrama != null) {
    dramaMainInfoEntity.canBuyoutDrama = canBuyoutDrama;
  }
  final double? buyoutDramaAmount = jsonConvert.convert<double>(
      json['buyout_drama_amount']);
  if (buyoutDramaAmount != null) {
    dramaMainInfoEntity.buyoutDramaAmount = buyoutDramaAmount;
  }
  final String? buyoutDramaId = jsonConvert.convert<String>(
      json['buyout_drama_id']);
  if (buyoutDramaId != null) {
    dramaMainInfoEntity.buyoutDramaId = buyoutDramaId;
  }
  return dramaMainInfoEntity;
}

Map<String, dynamic> $DramaMainInfoEntityToJson(DramaMainInfoEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['chn_id'] = entity.chnId;
  data['type'] = entity.type;
  data['title'] = entity.title;
  data['cover'] = entity.cover;
  data['all_ep'] = entity.allEp;
  data['update_ep'] = entity.updateEp;
  data['charge_sort'] = entity.chargeSort;
  data['is_end'] = entity.isEnd;
  data['desc'] = entity.desc;
  data['ctime'] = entity.ctime;
  data['thumb_cover'] = entity.thumbCover;
  data['is_self'] = entity.isSelf;
  data['video_library_id'] = entity.videoLibraryId;
  data['video_library_name'] = entity.videoLibraryName;
  data['video_library_code'] = entity.videoLibraryCode;
  data['can_cur_pay'] = entity.canCurPay;
  data['can_vip_watch'] = entity.canVipWatch;
  data['can_ad_pay'] = entity.canAdPay;
  data['can_buyout_drama'] = entity.canBuyoutDrama;
  data['buyout_drama_amount'] = entity.buyoutDramaAmount;
  data['buyout_drama_id'] = entity.buyoutDramaId;
  return data;
}

extension DramaMainInfoEntityExtension on DramaMainInfoEntity {
  DramaMainInfoEntity copyWith({
    int? id,
    int? chnId,
    int? type,
    String? title,
    String? cover,
    int? allEp,
    int? updateEp,
    int? chargeSort,
    int? isEnd,
    String? desc,
    int? ctime,
    String? thumbCover,
    int? isSelf,
    int? videoLibraryId,
    String? videoLibraryName,
    String? videoLibraryCode,
    int? canCurPay,
    int? canVipWatch,
    int? canAdPay,
    int? canBuyoutDrama,
    double? buyoutDramaAmount,
    String? buyoutDramaId,
  }) {
    return DramaMainInfoEntity()
      ..id = id ?? this.id
      ..chnId = chnId ?? this.chnId
      ..type = type ?? this.type
      ..title = title ?? this.title
      ..cover = cover ?? this.cover
      ..allEp = allEp ?? this.allEp
      ..updateEp = updateEp ?? this.updateEp
      ..chargeSort = chargeSort ?? this.chargeSort
      ..isEnd = isEnd ?? this.isEnd
      ..desc = desc ?? this.desc
      ..ctime = ctime ?? this.ctime
      ..thumbCover = thumbCover ?? this.thumbCover
      ..isSelf = isSelf ?? this.isSelf
      ..videoLibraryId = videoLibraryId ?? this.videoLibraryId
      ..videoLibraryName = videoLibraryName ?? this.videoLibraryName
      ..videoLibraryCode = videoLibraryCode ?? this.videoLibraryCode
      ..canCurPay = canCurPay ?? this.canCurPay
      ..canVipWatch = canVipWatch ?? this.canVipWatch
      ..canAdPay = canAdPay ?? this.canAdPay
      ..canBuyoutDrama = canBuyoutDrama ?? this.canBuyoutDrama
      ..buyoutDramaAmount = buyoutDramaAmount ?? this.buyoutDramaAmount
      ..buyoutDramaId = buyoutDramaId ?? this.buyoutDramaId;
  }
}